# -*- encoding: utf-8 -*-

from django.db import models
from django.contrib.auth.models import User

class URL(models.Model):
    name = models.URLField(db_index=True)

    def __str__(self):
        return self.name
        
    class Admin:
        pass

class Kind(models.Model):
    name = models.CharField(maxlength=20)
	
    def __str__(self):
        return self.name

    class Admin:
        pass

class Bookmark(models.Model):
    title = models.CharField(maxlength=255)
    description = models.TextField()
    public = models.BooleanField()
    url = models.ForeignKey(URL)
    kind = models.ForeignKey(Kind)
    user = models.ForeignKey(User)
    born = models.DateTimeField(auto_now_add=True)
	
    def __str__(self):
        return self.title

    class Admin:
        pass

class Tag(models.Model):
    name = models.CharField(maxlength=25)
    alias = models.CharField(maxlength=25)
    bookmark = models.ManyToManyField(Bookmark)
	
    def __str__(self):
        return self.name
    class Admin:
        pass

